package com.lantu.sys.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import com.lantu.sys.entity.Clazz;
import com.lantu.sys.mapper.ClazzMapper;
import com.lantu.sys.service.ClazzService;
import org.springframework.stereotype.Service;

@Service
public class ClazzServiceImpl extends ServiceImpl<ClazzMapper, Clazz> implements ClazzService {
    @Override
    public IPage<Clazz> getClazzByOpr(Page<Clazz> pageParam, Clazz clazz) {
        QueryWrapper<Clazz> studentQueryWrapper =new QueryWrapper<>();
//        if(!StringUtils.isEmpty(clazz.getName())){
//            studentQueryWrapper.like("name",student.getName());
//        }
        if(!StringUtils.isEmpty(clazz.getClazzName())){
            studentQueryWrapper.like("clazz_name",clazz.getClazzName());
        }

        studentQueryWrapper.orderByAsc("id");
        Page<Clazz> clazzPage = baseMapper.selectPage(pageParam, studentQueryWrapper);
        return clazzPage;

    }
}
